package com.cloud.Bean;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component
@Slf4j
public class MayiktBean implements BeanNameAware, InitializingBean, ApplicationContextAware {

    public MayiktBean() {
        log.info("MayiktBean 构造方法执行...");
    }

    @Autowired
    public void getUser(MayiEntity mayiEntity) {
        log.info(" MayiktBean 依赖注入,mayiEntity:" + mayiEntity);
    }

    @PostConstruct
    public void init() {
        log.info(" MayiktBean init()...");
    }

    @PreDestroy
    public void destroy() {
        log.info("MayiktBean destroy()...");
    }

    @Override
    public void setBeanName(String s) {
        log.info(" MayiktBean setBeanName()...");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        log.info(" MayiktBean afterPropertiesSet()...");
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {

    }
}
